/**
 *  ObjectBuilder.java : IceBird project
 *  21:40:50 
 */
package icebird.utils;

import java.util.ArrayList;

/**
 * @author Sergey Shulepoff[Knott]
 */
public final class ObjectBuilder {

	private ArrayList<Object> list;
	
	/**
	 * Create array list.
	 */
	public ObjectBuilder() {
		list = new ArrayList<Object>();
	}

	/**
	 * Append line.
	 * @return void
	 */
	public void appendln() {
		list.add("\r\n");
	}
	
	public void append(Object obj) {
		list.add(obj);
	}
	
	/**
	 * Gets string representation.
	 */
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		
		for (Object obj : list) {
			buffer.append(obj);
		}
		
		return buffer.toString();
	}
	
	/**
	 * Remove last entry.
	 * @return void
	 */
	public void pop() {
		list.remove(list.size() - 1);
	}
}
